<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/jsp/common/navigationRight.jsp" %>
<%@include file="/WEB-INF/jsp/common/head.jsp" %>
<%@include file="/WEB-INF/jsp/common/navigationLeft.jsp" %>


<div class="m2-userCentermanage-con">
    <div class="m2-user-recharge">
        <h3><i class="m2-user-alertset"></i>通知设置</h3>
    </div>
    <div class="m2-recharge-mainbody">
        <div class="m2-user-setbtn">
            <script>
                window.confirm = function () {
                };
                window.prompt = function () {
                };
                window.open = function () {
                };
                window.print = function () {
                };
                // Support hover state for mobile.
                if (false) {
                    window.ontouchstart = function () {
                    };
                }
            </script>

            <table cellpadding="0" cellspacing="1" border="0">
                <tr>
                    <th></th>
                    <th>站内消息</th>
                    <th>邮件通知</th>
                    <th>短信通知</th>
                </tr>
                <form id="msgcfg" name="msgcfg" method="post">
                    <tr>
                        <td>充值成功</td>
                        <td>
                            <input type="checkbox" id="s1" name="recharge" <c:if test="${msgCfg.recharge.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s1"></label></td>
                        <td>
                            <input type="checkbox" id="s2" name="recharge" <c:if test="${msgCfg.recharge.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s2"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>投资成功</td>
                        <td>
                            <input type="checkbox" id="s4" <c:if test="${msgCfg.investment.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s4"></label></td>
                        <td>
                            <input type="checkbox" id="s5" <c:if test="${msgCfg.investment.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s5"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>收到本金或利息</td>
                        <td>
                            <input type="checkbox" id="s7" <c:if test="${msgCfg.receipt.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s7"></label></td>
                        <td>
                            <input type="checkbox" id="s8" <c:if test="${msgCfg.receipt.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s8"></label></td>
                        <td>
                            <input type="checkbox" id="s9" <c:if test="${msgCfg.receipt.substring(2,3) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s9"></label></td>
                    </tr>
                    <tr>
                        <td>收到平台奖励</td>
                        <td>
                            <input type="checkbox" id="s10" <c:if test="${msgCfg.reward.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s10"></label></td>
                        <td>
                            <input type="checkbox" id="s11" <c:if test="${msgCfg.reward.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s11"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>提现成功</td>
                        <td>
                            <input type="checkbox" id="s13" <c:if test="${msgCfg.takeOutMoney.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s13"></label></td>
                        <td>
                            <input type="checkbox" id="s14" <c:if test="${msgCfg.takeOutMoney.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s14"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>债权转让成功</td>
                        <td>
                            <input type="checkbox" id="s16" <c:if test="${msgCfg.transferClaim.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s16"></label></td>
                        <td>
                            <input type="checkbox" id="s17" <c:if test="${msgCfg.transferClaim.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s17"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>债权承接成功</td>
                        <td>
                            <input type="checkbox" id="s19" <c:if test="${msgCfg.getClaim.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s19"></label></td>
                        <td>
                            <input type="checkbox" id="s20" <c:if test="${msgCfg.getClaim.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s20"></label></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>项目公告</td>
                        <td>
                            <input type="checkbox" id="s22" <c:if test="${msgCfg.announcement.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s22"></label></td>
                        <td>
                            <input type="checkbox" id="s23" <c:if test="${msgCfg.announcement.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s23"></label></td>
                        <td>
                            <input type="checkbox" id="s24" <c:if test="${msgCfg.announcement.substring(2,3) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s24"></label></td>
                    </tr>
                    <tr>
                        <td>活动公告</td>
                        <td>
                            <input type="checkbox" id="s25" <c:if test="${msgCfg.activity.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s25"></label></td>
                        <td>
                            <input type="checkbox" id="s26" <c:if test="${msgCfg.activity.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s26"></label></td>
                        <td>
                            <input type="checkbox" id="s27" <c:if test="${msgCfg.activity.substring(2,3) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s27"></label></td>
                    </tr>
                    <tr>
                        <td>其他平台公告</td>
                        <td>
                            <input type="checkbox" id="s28" <c:if test="${msgCfg.other.substring(0,1) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s28"></label></td>
                        <td>
                            <input type="checkbox" id="s29" <c:if test="${msgCfg.other.substring(1,2) == 1}">checked=""</c:if>/>
                            <label class="slider-v2" for="s29"></label></td>
                        <td>
                        </td>
                    </tr>
                </form>

            </table>
            <div class="m2-user-setdown">
                <a>提交修改</a>
            </div>
        </div>
        <div class="m2-recharge-tips">
            <h3><i></i>温馨提示：</h3>
            <ul>
                <li><i class="m2-recharge-tips01"></i><b>为了您的资金安全，不建议您去掉重要的消息提醒。</b></li>
                <li><i class="m2-recharge-tips02"></i><b>如果您更换了邮箱，手机号，请您及时到 安全设置 页面修改。</b></li>
                <li><i class="m2-recharge-tips03"></i><b>使用过程遇到问题，请联系客服，4006-777-518。</b></li>
            </ul>
        </div>
    </div>
</div>
</div>
<script>
    if (document.location.search.match(/type=embed/gi)) {
        window.parent.postMessage('resize', "*");
    }
    $(function(){
        $('.m2-user-setdown a').click(function (){
            var array=new Array();
            $("input:checkbox").each(function () {
                k = $(this).attr('id');
                if ($(this).attr('checked') == 'checked') {v = 1;} else {v = 0;}
                array.push(v);
            });
            var arr=array.join("");
            var data={"uid":"${msgCfg.uid}","recharge":arr.substring(0,2),"investment":arr.substring(2,4),"receipt":arr.substring(4,7),"reward":arr.substring(7,9),"takeOutMoney":arr.substring(9,11),
                "transferClaim":arr.substring(11,13),"getClaim":arr.substring(13,15),"announcement":arr.substring(15,18),"activity":arr.substring(18,21),"other":arr.substring(21,23)}
            $.ajax({
                "url"          :  "/msg/cfgupd",                      // 要提交的URL路径
                "type"         :  "post",                     // 发送请求的方式
                "data"         :  data,                      // 要发送到服务器的数据
                "dataType" :  "json",                   // 指定传输的数据格式
                "success"  :  function(result) { // 请求成功后要执行的代码
                    alert(result)
                    },
                "error"       :  function() {           // 请求失败后要执行的代码
                }
            } );
            alert("修改成功")
        })
    })
</script>
</body>
</html>